
do "E:/ReplicateBuild/02_code/00_environment/00_set_environment.do"

*Table of Contents
local demData = 0
local expData = 0
local principalsData = 0
	local principals_id_sy = 1
	local FOCAL_principal_history = 0
local teachTestData = 1 // teacher Test Data (Praxis)
local educData = 1 //  BA date, MA date, BA inst, MA inst
	local dataCheck = 1
local teachCertificationData = 1
local teachLicenseData = 1
	
********************************************************************************
* Read in demographic data
********************************************************************************

if `demData' == 1 {
	********************************************************************************
	* Create dataset of teacher ethnicity and gender
	* Identifier: ncerdc_id
	********************************************************************************
	
	import sas using "$rawdata/Teacher/Pay/personnel_through18.sas7bdat", clear

	ren (teachid bdate ethnic) (ncerdc_id dob ethnicity)
	
	drop if ncerdc_id==.
	
	sort ncerdc_id
	unique ncerdc_id
	
	compress
	
	save "$basedata/ncerdc_demographics", replace

}

********************************************************************************
* Read in experience and salary data
********************************************************************************

if `expData' == 1 {
	********************************************************************************
	* Create dataset of teacher experience and salary
	* Identifier: ncerdc_id sy
	********************************************************************************
	
	
	forv yy=2000/2011 {
		import sas using "$rawdata/Teacher/Pay/lspaysnap`yy'.sas7bdat", clear
		
		if `yy' < 2004 {
			replace schlcode = "" if schlcode == "COA"
		}
		
		ren (cert_sal_amt pay_lvl_cd) (gross_pay pay_level)
		gen tchr_exp = .
		
		sort teachid fisyr lea schlcode
		
		replace pay_level = "" if !inlist(substr(pay_level,1,1),"M", "A", "3", "0")
		replace pay_level = substr(pay_level,2,.) if substr(pay_level,1,1)== "3"
		
		sort teachid fisyr lea schlcode
		destring pay_level, gen(tchr_exp_pay_level) ignore(" ABCDEFMNS") force
		
		*Get education level implied by pay level
		gen educ_pay_level = .
		replace educ_pay_level = 4 if substr(pay_level,1,1) == "A"
		replace educ_pay_level = 5 if substr(pay_level,1,1) == "M"
		replace educ_pay_level = 6 if substr(pay_level,1,2) == "MS"
		replace educ_pay_level = 7 if substr(pay_level,1,2) == "MD"
		
		*National Board for Professional Teaching Standards
		gen nbpts_cert = 0
		replace nbpts_cert = 1 if strpos(lower(pay_level),"n")>0
		
		destring bud_fnd_cd bud_purp_cd bud_prc_cd bud_obj_cd, replace
		
		*Who is paying?
		gen bud_fnd_local = 0
		replace bud_fnd_local = 1 if bud_fnd_cd == 1
		gen bud_fnd_state = 0
		replace bud_fnd_state = 1 if bud_fnd_cd == 2
		gen bud_fnd_fedal = 0
		replace bud_fnd_fedal = 1 if bud_fnd_cd == 3
		
		*Purpose of job
		**Regular Instruction Services (5100-5199)
		gen bud_purp_regular = 0
		replace bud_purp_regular = 1 if bud_purp_cd>=5100 & bud_purp_cd<=5199
		**Special Population Servies (5200-5299)
		gen bud_purp_special = 0
		replace bud_purp_special = 1 if bud_purp_cd>=5200 & bud_purp_cd<=5299
		**Alternative Programs and Services (5300-5399)
		gen bud_purp_alt = 0
		replace bud_purp_alt = 1 if bud_purp_cd>=5300 & bud_purp_cd<=5399
		**School Leadership Services (5400-5499)
		gen bud_purp_leader = 0
		replace bud_purp_leader = 1 if bud_purp_cd>=5400 & bud_purp_cd<=5499
		**School-Based Support Services like libarians, guidances counselors, etc. (5800-5899)
		gen bud_purp_support = 0
		replace bud_purp_support = 1 if bud_purp_cd>=5800 & bud_purp_cd<=5899
		**System-Wide Support Services (6000-6999)
		gen bud_purp_system = 0
		replace bud_purp_system = 1 if bud_purp_cd>=6000 & bud_purp_cd<=6999
		**Ancillary Services (7000-7999)
		gen bud_purp_ancil = 0
		replace bud_purp_ancil = 1 if bud_purp_cd>=7000 & bud_purp_cd<=7999
		
		*Teacher Object code
		gen bud_obj_teach = bud_obj_cd == 121
		gen bud_obj_princ = bud_obj_cd == 114
		gen bud_obj_asst_princ = bud_obj_cd == 116 | bud_obj_cd == 117
		
		*Adjust salary based on monthly
		replace gross_pay = gross_pay*mnths_exper_num
		replace gross_pay = 0 if gross_pay<0
		*Get salary for teaching
		preserve
			keep if bud_obj_teach == 1
			keep teachid gross_pay
			collapse (sum) gross_pay, by(teachid)
			rename gross_pay teach_pay
			
			tempfile temp_teach_pay
			save `temp_teach_pay', replace
		restore
		
		*Create flag for teachers being at paid by district
		gen schlcode000 = schlcode == "000"
		
		*Determine set of people paid by multiple schools (ignoring schlcod000)
		preserve
			drop if schlcode000 == 1
			keep teachid lea schlcode
			duplicates drop
			duplicates tag teachid, gen(dups)
			keep if dups > 0
			keep teachid
			duplicates drop
			tempfile temp_multi_schools
			save `temp_multi_schools', replace	
		restore
		
		sort fisyr teachid gross_pay
		
		collapse (last) lea schlcode tchr_exp bud_purp_cd bud_prc_cd bud_obj_cd (sum) gross_pay (max) tchr_exp_pay_level educ_pay_level nbpts_cert bud_fnd_local bud_fnd_state bud_fnd_fedal bud_purp_regular bud_purp_special bud_purp_alt bud_purp_leader bud_purp_support bud_purp_system bud_purp_ancil bud_obj_teach bud_obj_princ bud_obj_asst_princ schlcode000, by(teachid fisyr)
		destring lea schlcode, replace
		
		merge 1:1 teachid using `temp_teach_pay'
		assert _merge != 2
		replace teach_pay = . if _merge==1
		drop _merge
		
		merge m:1 teachid using `temp_multi_schools'
		assert _merge != 2
		gen multi_school = _merge == 3
		drop _merge
		
		assert fisyr==`yy'
		d
		
		
		tempfile temp`yy'
		save `temp`yy'', replace
		
	}
	
	
	forv yy=2012/2018 {
		use "$rawdata/Teacher/Pay/certsalpub`yy'", clear

		if `yy' == 2012 {
			gen gross_pay = gross_pay_amt
		}
		else if `yy' > 2014 {
			gen gross_pay = total_gross_pay
		}
		
		if `yy' == 2013 | `yy' == 2014 {
			rename cert_sal gross_pay
			replace gross_pay = gross_pay*10
			rename fte empld_pct
			replace empld_pct = empld_pct*100
		}
		
		
		replace pay_level = "" if !inlist(substr(pay_level,1,1),"M", "A", "3", "0")
		replace pay_level = substr(pay_level,2,.) if substr(pay_level,1,1)== "3"
		
		sort teachid fisyr lea schlcode
		destring pay_level, gen(tchr_exp_pay_level) ignore(" ABCDEFMNS") force
		
		*Get education level implied by pay level
		gen educ_pay_level = .
		replace educ_pay_level = 4 if substr(pay_level,1,1) == "A"
		replace educ_pay_level = 5 if substr(pay_level,1,1) == "M"
		replace educ_pay_level = 6 if substr(pay_level,1,2) == "MS"
		replace educ_pay_level = 7 if substr(pay_level,1,2) == "MD"
		
		*National Board for Professional Teaching Standards
		gen nbpts_cert = 0
		replace nbpts_cert = 1 if strpos(lower(pay_level),"n")>0
		replace nbpts_cert = . if fisyr == "2012"
		
		destring bud_fnd_cd bud_purp_cd bud_prc_cd bud_obj_cd prin_exp, replace
		
		*Who is paying?
		gen bud_fnd_local = 0
		replace bud_fnd_local = 1 if bud_fnd_cd == 1
		gen bud_fnd_state = 0
		replace bud_fnd_state = 1 if bud_fnd_cd == 2
		gen bud_fnd_fedal = 0
		replace bud_fnd_fedal = 1 if bud_fnd_cd == 3
		
		*Purpose of job
		**Regular Instruction Services (5100-5199)
		gen bud_purp_regular = 0
		replace bud_purp_regular = 1 if bud_purp_cd>=5100 & bud_purp_cd<=5199
		**Special Population Servies (5200-5299)
		gen bud_purp_special = 0
		replace bud_purp_special = 1 if bud_purp_cd>=5200 & bud_purp_cd<=5299
		**Alternative Programs and Services (5300-5399)
		gen bud_purp_alt = 0
		replace bud_purp_alt = 1 if bud_purp_cd>=5300 & bud_purp_cd<=5399
		**School Leadership Services (5400-5499)
		gen bud_purp_leader = 0
		replace bud_purp_leader = 1 if bud_purp_cd>=5400 & bud_purp_cd<=5499
		**School-Based Support Services like libarians, guidances counselors, etc. (5800-5899)
		gen bud_purp_support = 0
		replace bud_purp_support = 1 if bud_purp_cd>=5800 & bud_purp_cd<=5899
		**System-Wide Support Services (6000-6999)
		gen bud_purp_system = 0
		replace bud_purp_system = 1 if bud_purp_cd>=6000 & bud_purp_cd<=6999
		**Ancillary Services (7000-7999)
		gen bud_purp_ancil = 0
		replace bud_purp_ancil = 1 if bud_purp_cd>=7000 & bud_purp_cd<=7999
		
		*Teacher Object code
		gen bud_obj_teach = bud_obj_cd == 121
		gen bud_obj_princ = bud_obj_cd == 114
		gen bud_obj_asst_princ = bud_obj_cd == 116 | bud_obj_cd == 117
		
		*Adjust salary based on monthly
		replace gross_pay = 0 if gross_pay<0
		*Get salary for teaching
		preserve
			keep if bud_obj_teach == 1
			keep teachid gross_pay
			collapse (sum) gross_pay, by(teachid)
			rename gross_pay teach_pay
			
			tempfile temp_teach_pay
			save `temp_teach_pay', replace
		restore
		
		*Create flag for teachers being at paid by district
		gen schlcode000 = schlcode == "000"
		
		*Determine set of people paid by multiple schools (ignoring schlcod000)
		preserve
			drop if schlcode000 == 1
			keep teachid lea schlcode
			duplicates drop
			duplicates tag teachid, gen(dups)
			keep if dups > 0
			keep teachid
			duplicates drop
			tempfile temp_multi_schools
			save `temp_multi_schools', replace	
		restore
			
		sort fisyr teachid gross_pay	
		
		collapse (last) lea schlcode tchr_exp bud_purp_cd bud_prc_cd bud_obj_cd (sum) gross_pay (max) prin_exp tchr_exp_pay_level educ_pay_level nbpts_cert bud_fnd_local bud_fnd_state bud_fnd_fedal bud_purp_regular bud_purp_special bud_purp_alt bud_purp_leader bud_purp_support bud_purp_system bud_purp_ancil bud_obj_teach bud_obj_princ bud_obj_asst_princ schlcode000, by(teachid fisyr)
		destring lea schlcode, replace
		
		merge 1:1 teachid using `temp_teach_pay'
		assert _merge != 2
		replace teach_pay = . if _merge==1
		drop _merge
		
		merge m:1 teachid using `temp_multi_schools'
		assert _merge != 2
		gen multi_school = _merge == 3
		drop _merge
		
		
		destring fisyr, replace
		assert fisyr==`yy'

		
		tempfile temp`yy'
		save `temp`yy'', replace
		
	}
	
	clear
	forv yy=2000/2018 {
		append using `temp`yy''
	}
	
	if `dataCheck' == 1 {
		tab fisyr
		unique teachid fisyr
		
		xtset teachid fisyr
		gen expL = L.tchr_exp
		count if tchr_exp>=expL & expL!=. // we have some non-monotonicities; could be experience resetting but seems unlikely because happens even if school and lea are unchanged
		drop expL
	}
	
	label define educ_label 4 "Bachelors" 5 "Masters" 6 "Advanced" 7 "Doctorate" 
	label values educ_pay_level educ_label 
	
	xtset teachid fisyr
	gen expL = L.tchr_exp
	gen fisyrL = L.fisyr
	replace tchr_exp = . if tchr_exp<expL & expL!=.
	replace tchr_exp = . if tchr_exp-expL>1 & expL!=. & fisyr==fisyrL+1
	drop expL fisyrL
	
	gen expL = L.tchr_exp_pay_level
	gen fisyrL = L.fisyr
	replace tchr_exp_pay_level = . if tchr_exp_pay_level<expL & expL!=.
	replace tchr_exp_pay_level = . if tchr_exp_pay_level-expL>1 & expL!=. & fisyr==fisyrL+1
	drop expL fisyrL
	
	ren (teachid fisyr lea schlcode tchr_exp) (ncerdc_id sy ncerdc_lea ncerdc_schlcode ncerdc_exp)
	drop if ncerdc_id==.
	sort ncerdc_id sy
	compress
	
	save "$basedata/ncerdc_experience", replace
	
}

if `principalsData' == 1{
    if `principals_id_sy' == 1{
		use "$basedata/ncerdc_experience.dta", clear
		keep if bud_obj_princ == 1
		keep ncerdc_lea ncerdc_schlcode sy ncerdc_id gross_pay tchr_exp_pay_level prin_exp
		
		*85% of schools have only one "principal." For those with multiple, pick the one with the highest gross pay.
		duplicates report ncerdc_lea ncerdc_schlcode sy if ncerdc_schlcode!=0

		duplicates tag ncerdc_lea ncerdc_schlcode sy, gen(dups)
		
		gen principal_count = dups+1
		drop dups
		
		sort ncerdc_lea ncerdc_schlcode sy gross_pay
		
		bysort ncerdc_lea ncerdc_schlcode sy: keep if _n==_N
		drop if missing(ncerdc_schlcode)
		
		isid ncerdc_lea ncerdc_schlcode sy 
		
		save "$basedata/ncerdc_principals", replace
	}

	if `FOCAL_principal_history' == 1{
	    use "$basedata/ncerdc_principals", clear
		/* keep if ncerdc_lea==XXX */ // replaced value with XXX to preserve confidentiality
		keep principal_id
		duplicates drop
		
		tempfile temp_FOCAL_principals
		save `temp_FOCAL_principals', replace
		
		use "$basedata/ncerdc_experience.dta", clear
		/* keep if ncerdc_lea==XXX */ // replaced value with XXX to preserve confidentiality
		rename ncerdc_id principal_id
		merge m:1 principal_id using `temp_FOCAL_principals'
		keep if _merge==3
		drop _merge
		
		keep principal_id ncerdc_schlcode sy
		
		drop if ncerdc_schlcode == 0 | ncerdc_schlcode==.
		
		bysort ncerdc_schlcode sy: gen num = _n
		
		reshape wide principal_id, j(num) i(ncerdc_schlcode sy)
		
		tempfile temp_wide_school_princ
		save `temp_wide_school_princ', replace
		
		use "$basedata/ncerdc_experience.dta", clear
		/* keep if ncerdc_lea==XXX */ // replaced value with XXX to preserve confidentiality
		
		keep ncerdc_id ncerdc_schlcode sy
		
		merge m:1 ncerdc_schlcode sy using `temp_wide_school_princ'
		keep if _merge==3
		drop _merge
		
		reshape long principal_id, i(ncerdc_id ncerdc_schlcode sy) j(num)
		drop if missing(principal_id)
		drop num
		
		bysort ncerdc_id principal_id: egen first_meet_tp = min(sy)
		keep ncerdc_id principal_id first_meet_tp
		duplicates drop
		
		save "$basedata/FOCAL_teacher_princip_meetings.dta", replace
	}
}
		
	

********************************************************************************
* Read in teacher certification test data
********************************************************************************

if `teachTestData' == 1 {
	********************************************************************************
	* Create dataset of teacher test data
	* Identifier: ncerdc_id
	********************************************************************************
	
	
	forv yy=2008/2011 {
		import sas using "$rawdata/Teacher/Testing/lstestsnap`yy'.sas7bdat", clear
		keep if tst_type_cd=="PRAXIS"
		ren (teachid tst_score_num tst_date tst_cd) (ncerdc_id tst_score tst_date tst_cd)

		gen tst_year = year(tst_date)
		
		tempfile temp`yy'
		save `temp`yy'', replace
		
	}
	
	
	forv yy=12/18 {
		import sas using "$rawdata/Teacher/Testing/test_pub`yy'.sas7bdat", clear
		keep if tst_type_cd=="PRAXIS"
		ren (teachid tst_score_num tst_date tst_cd) (ncerdc_id tst_score tst_date tst_cd)

		gen tst_year = year(tst_date)
		
		tempfile temp`yy'
		save `temp`yy'', replace
		
	}
	
	clear
	forv yy=2008/2011 {
		append using `temp`yy''
	}
	forv yy=12/18 {
		append using `temp`yy''
	}
	
	duplicates drop
	
	bys tst_cd tst_year: egen mean_score = mean(tst_score)
	bys tst_cd tst_year: egen sd_score = sd(tst_score)
	
	gen teacher_test_score_std = (tst_score-mean_score)/sd_score

	collapse (mean) teacher_test_score_std, by(ncerdc_id tst_cd tst_year)

	drop if ncerdc_id==.
	sort ncerdc_id
	compress
	
	save "$basedata/ncerdc_teacher_tests", replace
	
}


if `educData' == 1 {
	********************************************************************************
	* Create dataset of teacher education data
	* Identifier: ncerdc_id
	********************************************************************************
	import sas using "$rawdata/Teacher/Education/lsprseduc2011.sas7bdat", clear
	keep ihe_id ihe_nm
	ren (ihe_id ihe_nm) (inst_code inst_name)

	duplicates drop
	drop if inst_name==""
	replace inst_name = upper(inst_name)
	sort inst_code
	tempfile tempinst
	save `tempinst', replace
	
	forv yy=2008/2011 {
		import sas using "$rawdata/Teacher/Education/lsprseduc`yy'.sas7bdat", clear
		ren (teachid grad_date educ_lvl_cd ihe_id) (ncerdc_id graduation_date educational_attainment inst_code)
		
		keep ncerdc_id graduation_date educational_attainment inst_code
		
		destring educational_attainment, replace
		duplicates drop
		
		tempfile temp`yy'
		save `temp`yy'', replace

	}	
	
	forv yy=12/19 {
		import sas using "$rawdata/Teacher/Education/educ_pub`yy'.sas7bdat", clear
		ren (teachid grad_date educ_lvl_cd ihe_id) (ncerdc_id graduation_date educational_attainment inst_code)
		
		keep ncerdc_id graduation_date educational_attainment inst_code
		
		destring educational_attainment, replace
		duplicates drop
		
		tempfile temp`yy'
		save `temp`yy'', replace

	}	
		

	clear
	forv yy=2008/2011 {
		append using `temp`yy''
	}
	forv yy=12/19 {
		append using `temp`yy''
	}	
	
	duplicates drop
	
	drop if ncerdc_id==.
	
	local sortvars = "ncerdc_id graduation_date educational_attainment inst_code"
	
	if `dataCheck' == 1 {
		duplicates tag `sortvars', gen(dupvar)
		assert dupvar==0
		drop dupvar

	}
	
	sort inst_code
	merge n:1 inst_code using `tempinst'
	drop if _m==2
	drop _m
	
	label define educational_attainment 4 "Bachelors" 5 "Masters" 6 "Advanced" 7 "Doctorate"

	sort `sortvars'

	by ncerdc_id: gen educ_event_id = _n
	

	sort ncerdc_id educ_event_id

	compress
	
	save "$basedata/ncerdc_education", replace

}


********************************************************************************
* Read in teacher certification data
********************************************************************************

if `teachCertificationData' == 1 {
	********************************************************************************
	* Create dataset of teacher certification data
	* Identifier: ncerdc_id
	********************************************************************************
	
	
	forv yy=2014/2019 {
		import sas using "$rawdata/Teacher/NBCertification/natcert_pub`yy'.sas7bdat", clear
		keep if ntc_type_cd=="NBPTS"
		gen year = `yy'
		keep year teachid
		tempfile temp`yy'
		save `temp`yy'', replace
		
	}
	
	
	clear
	forv yy=2014/2019 {
		append using `temp`yy''
	}

	collapse (min) firstyr_cert=year (max) lastyr_cert=year, by(teachid)
	
	ren teachid ncerdc_id
	

	
	save "$basedata/ncerdc_teacher_certification", replace
	
}

********************************************************************************
* Read in teacher license data
********************************************************************************

if `teachLicenseData' == 1 {
	********************************************************************************
	* Create dataset of teacher license data
	* Identifier: ncerdc_id
	********************************************************************************
	
	forval yy = 1995/2018 {
	    if  `yy' < 2012 {
		    import sas using "$rawdata/Teacher/License/licsal_pay_lic`yy'.sas7bdat", clear
		}
		if `yy' >= 2012 & `yy' <= 2018 {
			local yy_short = `yy' - 2000
		    import sas using "$rawdata/Teacher/License/area_pub`yy_short'.sas7bdat", clear
		}
		
		if `yy' <= 2009 {
		    cap gen hq_cd = ""
			cap tostring(hq_cd), replace
		}
		
		if `yy' == 2010 | `yy' == 2011 {
			tostring(hq_cd), replace
			rename lic_area_cd lic_area_cd_num
			gen str5 lic_area_cd = string(lic_area_cd_num,"%05.0f")
		}
		
		gen year = `yy'
		
		gen standard_license = inlist(pgm_sts_cd,"0","8","S")
		
		gen highly_qualified = inlist(hq_cd,"80","81","82","83","84","85","86","87","88") | inlist(hq_cd,"89")
		
		
		gen license_subject = ""
		replace license_subject = "english" if inlist(lic_area_cd,"25190","78180","00100","00190")
		replace license_subject = "math" if inlist(lic_area_cd,"25200","78200","00200")
		replace license_subject = "science" if inlist(lic_area_cd,"25300","78300","00300","00302","00310","00320","00330")
		replace license_subject = "social_studies" if inlist(lic_area_cd,"78400","00400","00405","00410","00420","00431","00432","00433")
		
		replace license_subject = "other_language" if inlist(lic_area_cd,"00510","00520","00530","00540","00550","00560","00580","00590") | inlist(lic_area_cd,"00511","00521","00531","00541","00551","00561","00581","00585")
		
		replace license_subject = "artmusic" if inlist(lic_area_cd,"00108","00109","00800","00805","00810","")
		
		replace license_subject = "pe" if inlist(lic_area_cd,"00090","00095","00096","00098")
		
		replace license_subject = "gen_elem" if inlist(lic_area_cd,"00025")
		
		replace license_subject = "esl" if inlist(lic_area_cd,"25110","00110")
		
		replace license_subject = "ec" if inlist(lic_area_cd,"25881","25882","88001","88002","88004","88081","88083","88085","88086") | inlist(lic_area_cd,"88088","88091","88092")
		
		replace license_subject = "preschool" if inlist(lic_area_cd,"00014","00015")
		
		replace license_subject = "admin" if inlist(lic_area_cd,"00011","00012","00013","00113","00077","00078","00711")
		
		replace license_subject = "student_services" if inlist(lic_area_cd,"00005","00006","00008","00026","00074","00075","00076","88099")
		
		replace license_subject = "other" if license_subject == ""
		
		gen license_grades = ""
		replace license_grades = "Elementary" if inlist(lic_area_cd,"00014","00015","00025","25110","25190","25200","25300","25881","25882") | inlist(lic_area_cd,"16000")
		replace license_grades = "Middle" if inlist(lic_area_cd,"78180","78200","78300","78400","78700","78710","78720","78730","78760") | inlist(lic_area_cd,"78820")
		replace license_grades = "High" if inlist(lic_area_cd,"00100","00200","00300","00302","00310","00320","00330","00400","00405") | inlist(lic_area_cd,"00410","00420","00431","00432","00433","00510","00520","00530","00540") | inlist(lic_area_cd,"00550","00560","00580","00590","00600","00601","00905","18000","18105") | inlist(lic_area_cd,"18434","18540","18550","18560","18825","18827","18829")
		replace license_grades = "Unspecified" if license_grades == ""
		
		tempfile temp_license_`yy'
		save `temp_license_`yy'', replace
		
	}
	
	
	clear
	forval yy=1995/2018 {
		append using `temp_license_`yy''
	}
	
	gen std_license_year = year(effect_date) if standard_license == 1
	gen hq_year = year(hq_date) if highly_qualified == 1
	
	bysort teachid: egen std_license_fy = min(std_license_year)
	bysort teachid: egen hq_fy = min(hq_year)
	
	ren teachid ncerdc_id
	ren year sy

	save "$basedata/ncerdc_teacher_license", replace
	
}